import json


# 文件写入方法
def write_data(file_name, data, file_type='txt'):
    with open('../data/{}.{}'.format(file_name, file_type), 'w', encoding='utf-8') as fp:
        if file_type == 'json':
            json.dump(data, fp, ensure_ascii=False)
        else:
            fp.write(data)